package com.zenika.zenbinding.sample.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.zenika.zenbinding.client.model.BusinessObject;

public class Person implements BusinessObject {

	private String name;
	private String firstName;
	private int age;
	private String sex;
	private Category category;
	private boolean bachelor;
	private Date birthday;
	private City city;
	private String comment;
	private Long test1;
	private boolean test2;
	private Boolean test3;
	private Language language;
	private Dialect dialect;
	private Boolean occupation;
	private Long level;

	/**
	 * @gwt.typeArgs <com.zenika.zenbinding.sample.model.City>
	 */
	private Set test4 = new HashSet(0);

	public City getCity() {
		return this.city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public Person() {
		super();
	}

	public Person(String name, String firstName) {
		super();
		this.name = name;
		this.firstName = firstName;
	}

	public Person(String name, String firstName, City city) {
		super();
		this.name = name;
		this.firstName = firstName;
		this.city = city;
	}

	public Person(String name, String firstName, City city, Long level) {
		super();
		this.name = name;
		this.firstName = firstName;
		this.city = city;
		this.level = level;
	}

	public String toString() {
		String languageSpeaking = "no language selected";
		String dialectSpeaking = "no dialect selected";

		if (this.language != null)
			languageSpeaking = this.language.getName();

		if (this.dialect != null)
			dialectSpeaking = this.dialect.getName();

		String resultat = this.firstName + ", " + this.name + ", " + this.sex + ", " + this.age + "ans";

		if (this.birthday != null) {
			resultat += ", né le " + this.birthday.getDate() + "/" + (this.birthday.getMonth() + 1);
		}

		resultat += ", " + ((this.bachelor) ? "célibataire" : "marrié") + ", ";
		if (this.category != null) {
			resultat += this.category.getName() + ", ";
		}

		resultat += ((this.occupation != null && this.occupation.booleanValue()) ? "Etudiant" : "Employé" + ", "
				+ languageSpeaking + ", " + dialectSpeaking);
		
		resultat += " level : " + this.level;

		return resultat;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public int getAge() {
		return this.age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public boolean isBachelor() {
		return bachelor;
	}

	public void setBachelor(boolean bachelor) {
		this.bachelor = bachelor;
	}

	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Long getTest1() {
		return test1;
	}

	public void setTest1(Long test1) {
		this.test1 = test1;
	}

	public boolean isTest2() {
		return test2;
	}

	public void setTest2(boolean test2) {
		this.test2 = test2;
	}

	public Boolean getTest3() {
		return test3;
	}

	public void setTest3(Boolean test3) {
		this.test3 = test3;
	}

	public Set getTest4() {
		return test4;
	}

	public void setTest4(Set test4) {
		this.test4 = test4;
	}

	public Boolean getOccupation() {
		return occupation;
	}

	public void setOccupation(Boolean occupation) {
		this.occupation = occupation;
	}

	public Language getLanguage() {
		return language;
	}

	public void setLanguage(Language language) {
		this.language = language;
	}

	public Dialect getDialect() {
		return dialect;
	}

	public void setDialect(Dialect dialect) {
		this.dialect = dialect;
	}

	public Long getLevel() {
		return level;
	}

	public void setLevel(Long level) {
		this.level = level;
	}

}
